"""
--coding:utf-8--
@File: hello.py
@Author:frank yu
@DateTime: 2020.08.19 16:02
@Contact: frankyu112058@gmail.com
@Description:this is module for test
"""
from log import *

log = Log()


class Hello:
    def __init__(self):
        pass

    def debug(self, **kwargs):
        info = kwargs.get('d_info')
        log.log_show_store(info, logging.DEBUG)

    def info(self, **kwargs):
        info = kwargs.get('i_info')
        log.log_show_store(info, logging.INFO)

    def warning(self, **kwargs):
        info = kwargs.get('w_info')
        log.log_show_store(info, logging.WARN)

    def error(self, **kwargs):
        info = kwargs.get('e_info')
        log.log_show_store(info, logging.ERROR)

    def critical(self, **kwargs):
        info = kwargs.get('c_info')
        log.log_show_store(info, logging.CRITICAL)

    def set_log(self, **kwargs):
        level = kwargs.get('l')
        # print(level)
        if level == "debug":
            log.logger.setLevel(logging.DEBUG)
        elif level == "info":
            log.logger.setLevel(logging.INFO)
        elif level == "warn":
            log.logger.setLevel(logging.WARN)
        elif level == "error":
            log.logger.setLevel(logging.ERROR)
        elif level == "critical":
            log.logger.setLevel(logging.CRITICAL)
        else:
            log.log_show("please input -l", logging.CRITICAL)
            exit(0)
